package com.cont;

import com.annotations.web.Controller;
import com.annotations.web.RequestBody;
import com.annotations.web.RequestMapping;
import com.annotations.web.RequestParam;
import com.constant.RequestMethod;
import com.domin.LoadFile;
import com.domin.Student;
import io.netty.handler.codec.http.multipart.FileUpload;
import lombok.extern.slf4j.Slf4j;

/**
 * @author linyu.dai
 * @project rpc
 * @description
 * @creat 2022/11/29 20:06:02
 */
@Controller("/a")
@Slf4j
public class A {

    @RequestMapping(url = "/get1",method = {RequestMethod.GET, RequestMethod.POST})
    public Student tutu1(@RequestParam("student") Student student){
        return student;
    }

    @RequestMapping(url = "/get6",method = {RequestMethod.GET})
    public String tutu6(@RequestParam("a") String a){
        return a;
    }

    @RequestMapping(url = "/get2",method = {RequestMethod.GET})
    public Student tutu2(){
        return new Student("戴林宇2",13);
    }

    @RequestMapping(url = "/get3",method = {RequestMethod.GET})
    public Student tutu3(@RequestParam("name") String name, @RequestParam("age") Integer age){
        return new Student(name,age);
    }

    @RequestMapping(url = "/get4",method = {RequestMethod.POST})
    public Student tutu4(@RequestBody Student student){
        return student;
    }

    @RequestMapping(url = "/get5",method = {RequestMethod.POST})
    public Student tutu5(@RequestParam("name") String name, @RequestParam("age") Integer age){
        return new Student(name,age);
    }

    @RequestMapping(url = "/get7",method = {RequestMethod.POST})
    public String tutu7(@RequestParam("a") FileUpload a,@RequestParam("b") String b){
        log.info("参数内容{}", a);
        log.info("参数内容{}", b);
        return "上传文件";
    }

    @RequestMapping(url = "/get8",method = {RequestMethod.POST})
    public String tutu8(LoadFile fileUpload){
        log.info("参数内容{}", fileUpload);
        return "上传文件";
    }

}
